package com.hzw.saas.api.storage.exception;

import java.util.ArrayList;
import java.util.List;

import com.hzw.saas.api.storage.bo.ResourceFileConflictBO;
import com.hzw.saas.common.util.exception.ConflictException;
import lombok.Getter;
import lombok.Setter;

/**
 * 文件未找到异常
 *
 * @author zzl
 * @since 02/25/2021
 */
public class FileConflictException extends ConflictException {

    private static final long serialVersionUID = 1L;

    @Getter
    @Setter
    private List<ResourceFileConflictBO> errorFileList = new ArrayList<>();

    private FileConflictException(String message) {
        super(message);
    }

    public FileConflictException(String message, List<ResourceFileConflictBO> errorFileList) {
        this(message);
        this.errorFileList = errorFileList;
    }

    public static FileConflictException build(String message, List<ResourceFileConflictBO> errorFileList) {
        return new FileConflictException(message, errorFileList);
    }

    public static FileConflictException build(String message, ResourceFileConflictBO errorFile) {
        FileConflictException exception = new FileConflictException(message);
        exception.getErrorFileList().add(errorFile);
        return exception;
    }
}
